package com.qujia.common.enums;


import java.util.Arrays;


public enum WxConsumptionMessageEnum implements KeyValueable<Integer> {
	
	
	/**
	 * 优惠券发券推送
	 */
	COUPON_ISSUANCE_PUSH("CouponIssuanceaAndPush",1),
	
	/**
	 * 优惠券发券推送指定个人
	 */
	PERSONAL_COUPON_ISSUANCE_PUSH("PersonalCouponIssuanceaAndPush",2),
	/**
	 * 优惠活动消息推送
	 */
	ACTIVITY_MESSAGE_PUSH("activityMessagePush",3),

	OIL_PRICE_ADJUSTMENT_PUSH("oilPriceAdjustmentPush",4),
	/**
	 * 参与充值立减活动
	 */
	RECHARGE_REDUCTION_ACTIVITY("RECHARGE_REDUCTION_ACTIVITY",5),

	/**
	 * 电子卡余额调整通知消息推送
	 */
	BALANCE_CHANGE_PUSH("balanceChangePush",6),
	//退款推送
	REFUND_MESSAGE_PUSH("refundMessagePush",7),
	INTEGRAL_MESSAGE_PUSH("integralMessagePush",8),
	CHARGE_REFUND_MESSAGE_PUSH("chargeRefundMessagePush",9),

	PHYSICAL_CARD_CONSUMPTION_MESSAGE_PUSH("physicalCardConsumptionMessagePush",10),
	MONTHLY_CONSUMPTION_REPORT_PUSH("monthlyConsumptionReportPush",11)
	;
	
	

	private String key;//用来做国际化的KEY
	private Integer value;//数据库存的值

	// 构造方法
	WxConsumptionMessageEnum(String key, Integer value) {
		this.key = key;
		this.value = value;
	}

	//覆盖方法
	@Override
	public String toString() {
		return this.key + ":" + this.value;
	}


	@Override
	public Integer getValue() {
		return this.value;
	}

	@Override
	public String getKey() {
		return this.key;
	}


	/**
	 * 根据value获得枚举对象
	 * @param value value值
	 * @return
	 */
	public static WxConsumptionMessageEnum getByValue(Integer value){
		for(WxConsumptionMessageEnum messageEnum : values()){
			if (messageEnum.getValue().equals(value)) {
				return messageEnum;
			}
		}
		return null;
	}


	public static Integer getValue(String type) {
		return Arrays.stream(values()).filter(e -> e.getKey().equals(type)).findFirst().map(WxConsumptionMessageEnum::getValue).orElse(null);
	}

	public static String getKey(int value) {
		return Arrays.stream(values()).filter(e -> e.getValue().equals(value)).findFirst().map(WxConsumptionMessageEnum::getKey).orElse(null);
	}
	
}

